Day 14 조건문, 반복문, 시뮬레이션, 문자열

Day14 14단계 20231102

2. 369게임

class Solution {
    public int solution(int order) {
        String num = order+"";
        int answer = 0;
        for (int i = 0; i < num.length(); i++) {
            if (num.charAt(i) == '3' || num.charAt(i) == '6' || num.charAt(i) == '9') {
                answer++;
            }
        }
        return answer;
    }
}
int count = 0;
while(order != 0) {
	if (order % 10 == 3 || order % 10 == 6 || order % 10 == 9 ) {
		count++;
	}
	order /= 10;
}
return count;